package com.wicket.okrcomponent.biz.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.wicket.okrcomponent.biz.service.dto.req.*;
import com.wicket.okrcomponent.biz.service.dto.res.*;
import com.wicket.okrcomponent.common.exception.BizException;
import com.wicket.okrcomponent.common.util.CommonFunctionHelper;
import com.wicket.okrcomponent.common.util.RedisUtil;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.wicket.okrcomponent.common.exception.Assert;
import com.wicket.okrcomponent.base.service.MOmsBizFrameContentTagRecordService;
import com.wicket.okrcomponent.dal.po.mbg.OmsBizFrameContentTagRecord;
import com.wicket.okrcomponent.base.service.dto.req.QueryMessageTagRcordDetailReq;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@Service
public class ContTagRcordServiceImpl
  implements com.wicket.okrcomponent.biz.service.ContTagRcordService {

  @Resource
  private RedisUtil redisUtil;
/**
   * D2执行构建消息标签记录(公共)[7309]
   * gen by moon at 7/19/2023, 8:08:45 PM
   */
  @Trace(operationName = "D2执行构建消息标签记录(公共)")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public ImplementBuildMessageTagRcordComRespDto implementBuildMessageTagRcordCom(ImplementBuildMessageTagRcordComReqDto reqDto){
    
      
      String string_1 =null;
//virtualUsage 2-10-11查消息标签记录  47761
      OmsBizFrameContentTagRecord omsBizFrameContentTagRecord = null;
    QueryMessageTagRcordDetailReq queryMessageTagRcordDetailReq=new QueryMessageTagRcordDetailReq();
  queryMessageTagRcordDetailReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:1091902_1_47761
queryMessageTagRcordDetailReq.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1091903_1_47761
if(reqDto!=null){
      queryMessageTagRcordDetailReq.setTagName(reqDto.getTagName());//SimpleFieldAssign//sourceId:1091899_1_47761
queryMessageTagRcordDetailReq.setObjectContentId(reqDto.getObjectContentId());//SimpleFieldAssign//sourceId:1091900_1_47761
queryMessageTagRcordDetailReq.setThemeContentId(reqDto.getThemeContentId());//SimpleFieldAssign//sourceId:1091901_1_47761
    }
  
    /*2-10-11查消息标签记录[7307]   */
    Assert.isNull(queryMessageTagRcordDetailReq.getTagName(),"D2执行构建消息标签记录(公共)-2-10-11查消息标签记录-标签名称不能为空",false);
Assert.isNull(queryMessageTagRcordDetailReq.getObjectContentId(),"D2执行构建消息标签记录(公共)-2-10-11查消息标签记录-标签内容ID不能为空",false);
Assert.isNull(queryMessageTagRcordDetailReq.getThemeContentId(),"D2执行构建消息标签记录(公共)-2-10-11查消息标签记录-主题内容ID不能为空",false);
Assert.isNull(queryMessageTagRcordDetailReq.getSubjectLifeCycle(),"D2执行构建消息标签记录(公共)-2-10-11查消息标签记录-主体生命周期不能为空",false);
Assert.isNull(queryMessageTagRcordDetailReq.getSpaceId(),"D2执行构建消息标签记录(公共)-2-10-11查消息标签记录-创建于空间ID不能为空",false);
      omsBizFrameContentTagRecord = mOmsBizFrameContentTagRecordService.queryMessageTagRcordDetail(queryMessageTagRcordDetailReq)/*vcase invoke 本地 method 方法调用;*/;
      
      
      
if((omsBizFrameContentTagRecord == null )) {
        //if(2-10-11查消息标签记录.出参 值等于空 )  47762
        
String string = null;
    OmsBizFrameContentTagRecord omsBizFrameContentTagRecord_2=new OmsBizFrameContentTagRecord();
  omsBizFrameContentTagRecord_2.setBizAppContentCode("MESSAGE");//sourceId:1091906_1_47763
omsBizFrameContentTagRecord_2.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:1091910_1_47763
omsBizFrameContentTagRecord_2.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID//sourceId:1091911_1_47763
omsBizFrameContentTagRecord_2.setReleaseTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:1091912_1_47763
if(reqDto!=null){
      omsBizFrameContentTagRecord_2.setTagName(reqDto.getTagName());//SimpleFieldAssign//sourceId:1091905_1_47763
omsBizFrameContentTagRecord_2.setObjectContentId(reqDto.getObjectContentId());//SimpleFieldAssign//sourceId:1091907_1_47763
omsBizFrameContentTagRecord_2.setThemeContentTypeCode(reqDto.getThemeContentTypeCode());//SimpleFieldAssign//sourceId:1091908_1_47763
omsBizFrameContentTagRecord_2.setThemeContentId(reqDto.getThemeContentId());//SimpleFieldAssign//sourceId:1091909_1_47763
    }
  
    /*2-10-11新增消息标签记录[7308]   */
    Assert.isNull(omsBizFrameContentTagRecord_2.getTagName(),"D2执行构建消息标签记录(公共)-2-10-11新增消息标签记录-标签名称不能为空",false);
Assert.isNull(omsBizFrameContentTagRecord_2.getBizAppContentCode(),"D2执行构建消息标签记录(公共)-2-10-11新增消息标签记录-业务应用内容类型编码不能为空",false);
Assert.isNull(omsBizFrameContentTagRecord_2.getObjectContentId(),"D2执行构建消息标签记录(公共)-2-10-11新增消息标签记录-标签内容ID不能为空",false);
Assert.isNull(omsBizFrameContentTagRecord_2.getThemeContentTypeCode(),"D2执行构建消息标签记录(公共)-2-10-11新增消息标签记录-主题内容类型编码不能为空",false);
Assert.isNull(omsBizFrameContentTagRecord_2.getThemeContentId(),"D2执行构建消息标签记录(公共)-2-10-11新增消息标签记录-主题内容ID不能为空",false);
Assert.isNull(omsBizFrameContentTagRecord_2.getSubjectLifeCycle(),"D2执行构建消息标签记录(公共)-2-10-11新增消息标签记录-主体生命周期不能为空",false);
Assert.isNull(omsBizFrameContentTagRecord_2.getReleaseInductionId(),"D2执行构建消息标签记录(公共)-2-10-11新增消息标签记录-发布人就职记录ID不能为空",false);
Assert.isNull(omsBizFrameContentTagRecord_2.getReleaseTime(),"D2执行构建消息标签记录(公共)-2-10-11新增消息标签记录-发布时间不能为空",false);
      string = mOmsBizFrameContentTagRecordService.addMessageTagRcord(omsBizFrameContentTagRecord_2)/*vcase invoke 本地 method 方法调用;*/;
      
      
      string_1 = string;
      }
ImplementBuildMessageTagRcordComRespDto retData = new ImplementBuildMessageTagRcordComRespDto();
  if(string_1!=null){
      retData.setTagContentRecordId(string_1);//SimpleFieldAssign//sourceId:1091914_1
    }
  

  
  
return retData;
  }
  @Resource
  private MOmsBizFrameContentTagRecordService mOmsBizFrameContentTagRecordService;
  //
}
